3.71 \(\int \frac{\csc (e+f x)}{(a+b \tan ^2(e+f x))^2} \, dx\)

Optimal. Leaf size=110 \[ -\frac{\sqrt{b} (3 a-2 b) \tan ^{-1}\left (\frac{\sqrt{b} \sec (e+f x)}{\sqrt{a-b}}\right )}{2 a^2 f (a-b)^{3/2}}-\frac{\tanh ^{-1}(\cos (e+f x))}{a^2 f}-\frac{b \sec (e+f x)}{2 a f (a-b) \left (a+b \sec ^2(e+f x)-b\right )} \]

[Out]

-((3*a - 2*b)*Sqrt[b]*ArcTan[(Sqrt[b]*Sec[e + f*x])/Sqrt[a - b]])/(2*a^2*(a - b)^(3/2)*f) - ArcTanh[Cos[e + f*
x]]/(a^2*f) - (b*Sec[e + f*x])/(2*a*(a - b)*f*(a - b + b*Sec[e + f*x]^2))

________________________________________________________________________________________

Rubi [A]  time = 0.127508, antiderivative size = 110, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 5, integrand size = 21, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.238, Rules used = {3664, 414, 522, 207, 205} \[ -\frac{\sqrt{b} (3 a-2 b) \tan ^{-1}\left (\frac{\sqrt{b} \sec (e+f x)}{\sqrt{a-b}}\right )}{2 a^2 f (a-b)^{3/2}}-\frac{\tanh ^{-1}(\cos (e+f x))}{a^2 f}-\frac{b \sec (e+f x)}{2 a f (a-b) \left (a+b \sec ^2(e+f x)-b\right )} \]

Antiderivative was successfully verified.

[In]

Int[Csc[e + f*x]/(a + b*Tan[e + f*x]^2)^2,x]

[Out]

-((3*a - 2*b)*Sqrt[b]*ArcTan[(Sqrt[b]*Sec[e + f*x])/Sqrt[a - b]])/(2*a^2*(a - b)^(3/2)*f) - ArcTanh[Cos[e + f*
x]]/(a^2*f) - (b*Sec[e + f*x])/(2*a*(a - b)*f*(a - b + b*Sec[e + f*x]^2))

Rule 3664

Int[sin[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]^2)^(p_.), x_Symbol] :> With[{ff = Free
Factors[Sec[e + f*x], x]}, Dist[1/(f*ff^m), Subst[Int[((-1 + ff^2*x^2)^((m - 1)/2)*(a - b + b*ff^2*x^2)^p)/x^(
m + 1), x], x, Sec[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f, p}, x] && IntegerQ[(m - 1)/2]

Rule 414

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_))^(q_), x_Symbol] :> -Simp[(b*x*(a + b*x^n)^(p + 1)*(
c + d*x^n)^(q + 1))/(a*n*(p + 1)*(b*c - a*d)), x] + Dist[1/(a*n*(p + 1)*(b*c - a*d)), Int[(a + b*x^n)^(p + 1)*
(c + d*x^n)^q*Simp[b*c + n*(p + 1)*(b*c - a*d) + d*b*(n*(p + q + 2) + 1)*x^n, x], x], x] /; FreeQ[{a, b, c, d,
 n, q}, x] && NeQ[b*c - a*d, 0] && LtQ[p, -1] &&  !( !IntegerQ[p] && IntegerQ[q] && LtQ[q, -1]) && IntBinomial
Q[a, b, c, d, n, p, q, x]

Rule 522

Int[((e_) + (f_.)*(x_)^(n_))/(((a_) + (b_.)*(x_)^(n_))*((c_) + (d_.)*(x_)^(n_))), x_Symbol] :> Dist[(b*e - a*f
)/(b*c - a*d), Int[1/(a + b*x^n), x], x] - Dist[(d*e - c*f)/(b*c - a*d), Int[1/(c + d*x^n), x], x] /; FreeQ[{a
, b, c, d, e, f, n}, x]

Rule 207

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> -Simp[ArcTanh[(Rt[b, 2]*x)/Rt[-a, 2]]/(Rt[-a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && NegQ[a/b] && (LtQ[a, 0] || GtQ[b, 0])

Rule 205

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]*ArcTan[x/Rt[a/b, 2]])/a, x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rubi steps

\begin{align*} \int \frac{\csc (e+f x)}{\left (a+b \tan ^2(e+f x)\right )^2} \, dx &=\frac{\operatorname{Subst}\left (\int \frac{1}{\left (-1+x^2\right ) \left (a-b+b x^2\right )^2} \, dx,x,\sec (e+f x)\right )}{f}\\ &=-\frac{b \sec (e+f x)}{2 a (a-b) f \left (a-b+b \sec ^2(e+f x)\right )}+\frac{\operatorname{Subst}\left (\int \frac{2 a-b-b x^2}{\left (-1+x^2\right ) \left (a-b+b x^2\right )} \, dx,x,\sec (e+f x)\right )}{2 a (a-b) f}\\ &=-\frac{b \sec (e+f x)}{2 a (a-b) f \left (a-b+b \sec ^2(e+f x)\right )}+\frac{\operatorname{Subst}\left (\int \frac{1}{-1+x^2} \, dx,x,\sec (e+f x)\right )}{a^2 f}-\frac{((3 a-2 b) b) \operatorname{Subst}\left (\int \frac{1}{a-b+b x^2} \, dx,x,\sec (e+f x)\right )}{2 a^2 (a-b) f}\\ &=-\frac{(3 a-2 b) \sqrt{b} \tan ^{-1}\left (\frac{\sqrt{b} \sec (e+f x)}{\sqrt{a-b}}\right )}{2 a^2 (a-b)^{3/2} f}-\frac{\tanh ^{-1}(\cos (e+f x))}{a^2 f}-\frac{b \sec (e+f x)}{2 a (a-b) f \left (a-b+b \sec ^2(e+f x)\right )}\\ \end{align*}

Mathematica [A]  time = 0.818277, size = 184, normalized size = 1.67 \[ \frac{-\frac{2 a b \cos (e+f x)}{(a-b) ((a-b) \cos (2 (e+f x))+a+b)}+\frac{\sqrt{b} (3 a-2 b) \tan ^{-1}\left (\frac{\sqrt{a-b}-\sqrt{a} \tan \left (\frac{1}{2} (e+f x)\right )}{\sqrt{b}}\right )}{(a-b)^{3/2}}+\frac{\sqrt{b} (3 a-2 b) \tan ^{-1}\left (\frac{\sqrt{a-b}+\sqrt{a} \tan \left (\frac{1}{2} (e+f x)\right )}{\sqrt{b}}\right )}{(a-b)^{3/2}}+2 \log \left (\sin \left (\frac{1}{2} (e+f x)\right )\right )-2 \log \left (\cos \left (\frac{1}{2} (e+f x)\right )\right )}{2 a^2 f} \]

Antiderivative was successfully verified.

[In]

Integrate[Csc[e + f*x]/(a + b*Tan[e + f*x]^2)^2,x]

[Out]

(((3*a - 2*b)*Sqrt[b]*ArcTan[(Sqrt[a - b] - Sqrt[a]*Tan[(e + f*x)/2])/Sqrt[b]])/(a - b)^(3/2) + ((3*a - 2*b)*S
qrt[b]*ArcTan[(Sqrt[a - b] + Sqrt[a]*Tan[(e + f*x)/2])/Sqrt[b]])/(a - b)^(3/2) - (2*a*b*Cos[e + f*x])/((a - b)
*(a + b + (a - b)*Cos[2*(e + f*x)])) - 2*Log[Cos[(e + f*x)/2]] + 2*Log[Sin[(e + f*x)/2]])/(2*a^2*f)

________________________________________________________________________________________

Maple [A]  time = 0.084, size = 179, normalized size = 1.6 \begin{align*} -{\frac{\ln \left ( \cos \left ( fx+e \right ) +1 \right ) }{2\,f{a}^{2}}}-{\frac{b\cos \left ( fx+e \right ) }{2\,fa \left ( a-b \right ) \left ( a \left ( \cos \left ( fx+e \right ) \right ) ^{2}- \left ( \cos \left ( fx+e \right ) \right ) ^{2}b+b \right ) }}+{\frac{3\,b}{2\,fa \left ( a-b \right ) }\arctan \left ({ \left ( a-b \right ) \cos \left ( fx+e \right ){\frac{1}{\sqrt{b \left ( a-b \right ) }}}} \right ){\frac{1}{\sqrt{b \left ( a-b \right ) }}}}-{\frac{{b}^{2}}{f{a}^{2} \left ( a-b \right ) }\arctan \left ({ \left ( a-b \right ) \cos \left ( fx+e \right ){\frac{1}{\sqrt{b \left ( a-b \right ) }}}} \right ){\frac{1}{\sqrt{b \left ( a-b \right ) }}}}+{\frac{\ln \left ( \cos \left ( fx+e \right ) -1 \right ) }{2\,f{a}^{2}}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(csc(f*x+e)/(a+b*tan(f*x+e)^2)^2,x)

[Out]

-1/2/f/a^2*ln(cos(f*x+e)+1)-1/2/f*b/a/(a-b)*cos(f*x+e)/(a*cos(f*x+e)^2-cos(f*x+e)^2*b+b)+3/2/f*b/a/(a-b)/(b*(a
-b))^(1/2)*arctan((a-b)*cos(f*x+e)/(b*(a-b))^(1/2))-1/f*b^2/a^2/(a-b)/(b*(a-b))^(1/2)*arctan((a-b)*cos(f*x+e)/
(b*(a-b))^(1/2))+1/2/f/a^2*ln(cos(f*x+e)-1)

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(f*x+e)/(a+b*tan(f*x+e)^2)^2,x, algorithm="maxima")

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [B]  time = 2.68441, size = 1102, normalized size = 10.02 \begin{align*} \left [-\frac{2 \, a b \cos \left (f x + e\right ) -{\left ({\left (3 \, a^{2} - 5 \, a b + 2 \, b^{2}\right )} \cos \left (f x + e\right )^{2} + 3 \, a b - 2 \, b^{2}\right )} \sqrt{-\frac{b}{a - b}} \log \left (\frac{{\left (a - b\right )} \cos \left (f x + e\right )^{2} + 2 \,{\left (a - b\right )} \sqrt{-\frac{b}{a - b}} \cos \left (f x + e\right ) - b}{{\left (a - b\right )} \cos \left (f x + e\right )^{2} + b}\right ) + 2 \,{\left ({\left (a^{2} - 2 \, a b + b^{2}\right )} \cos \left (f x + e\right )^{2} + a b - b^{2}\right )} \log \left (\frac{1}{2} \, \cos \left (f x + e\right ) + \frac{1}{2}\right ) - 2 \,{\left ({\left (a^{2} - 2 \, a b + b^{2}\right )} \cos \left (f x + e\right )^{2} + a b - b^{2}\right )} \log \left (-\frac{1}{2} \, \cos \left (f x + e\right ) + \frac{1}{2}\right )}{4 \,{\left ({\left (a^{4} - 2 \, a^{3} b + a^{2} b^{2}\right )} f \cos \left (f x + e\right )^{2} +{\left (a^{3} b - a^{2} b^{2}\right )} f\right )}}, -\frac{a b \cos \left (f x + e\right ) +{\left ({\left (3 \, a^{2} - 5 \, a b + 2 \, b^{2}\right )} \cos \left (f x + e\right )^{2} + 3 \, a b - 2 \, b^{2}\right )} \sqrt{\frac{b}{a - b}} \arctan \left (-\frac{{\left (a - b\right )} \sqrt{\frac{b}{a - b}} \cos \left (f x + e\right )}{b}\right ) +{\left ({\left (a^{2} - 2 \, a b + b^{2}\right )} \cos \left (f x + e\right )^{2} + a b - b^{2}\right )} \log \left (\frac{1}{2} \, \cos \left (f x + e\right ) + \frac{1}{2}\right ) -{\left ({\left (a^{2} - 2 \, a b + b^{2}\right )} \cos \left (f x + e\right )^{2} + a b - b^{2}\right )} \log \left (-\frac{1}{2} \, \cos \left (f x + e\right ) + \frac{1}{2}\right )}{2 \,{\left ({\left (a^{4} - 2 \, a^{3} b + a^{2} b^{2}\right )} f \cos \left (f x + e\right )^{2} +{\left (a^{3} b - a^{2} b^{2}\right )} f\right )}}\right ] \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(f*x+e)/(a+b*tan(f*x+e)^2)^2,x, algorithm="fricas")

[Out]

[-1/4*(2*a*b*cos(f*x + e) - ((3*a^2 - 5*a*b + 2*b^2)*cos(f*x + e)^2 + 3*a*b - 2*b^2)*sqrt(-b/(a - b))*log(((a
- b)*cos(f*x + e)^2 + 2*(a - b)*sqrt(-b/(a - b))*cos(f*x + e) - b)/((a - b)*cos(f*x + e)^2 + b)) + 2*((a^2 - 2
*a*b + b^2)*cos(f*x + e)^2 + a*b - b^2)*log(1/2*cos(f*x + e) + 1/2) - 2*((a^2 - 2*a*b + b^2)*cos(f*x + e)^2 +
a*b - b^2)*log(-1/2*cos(f*x + e) + 1/2))/((a^4 - 2*a^3*b + a^2*b^2)*f*cos(f*x + e)^2 + (a^3*b - a^2*b^2)*f), -
1/2*(a*b*cos(f*x + e) + ((3*a^2 - 5*a*b + 2*b^2)*cos(f*x + e)^2 + 3*a*b - 2*b^2)*sqrt(b/(a - b))*arctan(-(a -
b)*sqrt(b/(a - b))*cos(f*x + e)/b) + ((a^2 - 2*a*b + b^2)*cos(f*x + e)^2 + a*b - b^2)*log(1/2*cos(f*x + e) + 1
/2) - ((a^2 - 2*a*b + b^2)*cos(f*x + e)^2 + a*b - b^2)*log(-1/2*cos(f*x + e) + 1/2))/((a^4 - 2*a^3*b + a^2*b^2
)*f*cos(f*x + e)^2 + (a^3*b - a^2*b^2)*f)]

________________________________________________________________________________________

Sympy [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(f*x+e)/(a+b*tan(f*x+e)**2)**2,x)

[Out]

Timed out

________________________________________________________________________________________

Giac [B]  time = 1.4036, size = 360, normalized size = 3.27 \begin{align*} -\frac{\frac{{\left (3 \, a b - 2 \, b^{2}\right )} \arctan \left (-\frac{a \cos \left (f x + e\right ) - b \cos \left (f x + e\right ) - b}{\sqrt{a b - b^{2}} \cos \left (f x + e\right ) + \sqrt{a b - b^{2}}}\right )}{{\left (a^{3} - a^{2} b\right )} \sqrt{a b - b^{2}}} + \frac{2 \,{\left (a b + \frac{a b{\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} - \frac{2 \, b^{2}{\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1}\right )}}{{\left (a^{3} - a^{2} b\right )}{\left (a + \frac{2 \, a{\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} - \frac{4 \, b{\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} + \frac{a{\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}}\right )}} - \frac{\log \left (-\frac{\cos \left (f x + e\right ) - 1}{\cos \left (f x + e\right ) + 1}\right )}{a^{2}}}{2 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(f*x+e)/(a+b*tan(f*x+e)^2)^2,x, algorithm="giac")

[Out]

-1/2*((3*a*b - 2*b^2)*arctan(-(a*cos(f*x + e) - b*cos(f*x + e) - b)/(sqrt(a*b - b^2)*cos(f*x + e) + sqrt(a*b -
 b^2)))/((a^3 - a^2*b)*sqrt(a*b - b^2)) + 2*(a*b + a*b*(cos(f*x + e) - 1)/(cos(f*x + e) + 1) - 2*b^2*(cos(f*x
+ e) - 1)/(cos(f*x + e) + 1))/((a^3 - a^2*b)*(a + 2*a*(cos(f*x + e) - 1)/(cos(f*x + e) + 1) - 4*b*(cos(f*x + e
) - 1)/(cos(f*x + e) + 1) + a*(cos(f*x + e) - 1)^2/(cos(f*x + e) + 1)^2)) - log(-(cos(f*x + e) - 1)/(cos(f*x +
 e) + 1))/a^2)/f